<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/6/27
 * Time: 16:18
 */

function p($str,$style=0)
{
    if(!$style)
    {
        echo "<pre>";
    }
    print_r($str);
    exit();
}
function v($str,$tag='',$style=0)
{
    if(!$style)
    {
        echo "<pre>";
    }
    echo $tag.'<br/>';
    print_r($str);
}

ini_set('display_errors', 'On');
ini_set('error_reporting', E_ALL);

$syspathinfo=$_SERVER['PATH_INFO'];

// +----------------------------------------------------------------------
// | start
// +----------------------------------------------------------------------
// | 解析pathinfo
// +----------------------------------------------------------------------
// | Author: json
// +----------------------------------------------------------------------

$syspathinfo=explode('/',$syspathinfo);
unset($syspathinfo[0]);

if(empty($syspathinfo[1])){
    $syspathinfo[1]='Index';
}
if(empty($syspathinfo[2]))
{
    $syspathinfo[2]='Index';
}
if(empty($syspathinfo[3]))
{
    $syspathinfo[3]='index';
}
foreach($syspathinfo as $k=>&$v)
{
    $v=ucwords($v);
    if(!empty($syspathinfo[$k])){
        if(strpos($syspathinfo[$k],'.')!==false){
            $syspathinfo[$k]=explode('.',$syspathinfo[$k])[0];
        }

    }
    $syspathinfo[3]=strtolower($syspathinfo[3]);
}
// +----------------------------------------------------------------------
// | end
// +----------------------------------------------------------------------
// | 解析pathinfo
// +----------------------------------------------------------------------
// | Author: json
// +----------------------------------------------------------------------

define('APP_PATH',dirname(dirname(__FILE__)));
define('MODULES_PATH',APP_PATH.'/modules/');
define('MODULE',$syspathinfo[1]);
define('CONTROLLER',$syspathinfo[2]);
define('METHOD',strtolower($syspathinfo[3]));
include_once APP_PATH.'/tool/Log.php';
include_once MODULES_PATH.'Common/functions.php';
include_once MODULES_PATH.'Common/Controller.php';

include MODULES_PATH.MODULE.'/Controller/'.CONTROLLER.'Controller.class.php';
$CONTROLLER=CONTROLLER.'Controller';
$CONTROLLER_OBJ=new $CONTROLLER();
call_user_func(array($CONTROLLER_OBJ, METHOD));






